<?php
include("connection/connection.php");
$frm=$_REQUEST['frmId'];
if(isset($_POST['submit']))
{
$sourceId=$_POST['critical_id'];


$critical=$_POST['critical'];
if($critical=="yes")
{
	$CH_quality=$_POST['CH_quality'];
		if(count($CH_quality)!=0)
		{	
			$CH_quality=implode(',',$CH_quality);
		}
		else
		{
			$CH_quality='';
		}
		
		$CH_quantity=$_POST['CH_quantity'];	
		if(count($CH_quantity)!=0)
		{	
			$CH_quantity=implode(',',$CH_quantity);
		}
		else
		{
			$CH_quantity='';
		}
	}
	else
	{
		$CH_quality='';
		$CH_quantity='';
		
	}

$qr2="UPDATE tbl_dtls_q2_critical SET critical='$critical', CH_quality='$CH_quality', CH_quantity='$CH_quantity' WHERE id='$sourceId'";		
		//echo $qr2;
$rec2=mysql_query($qr2);

$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','112','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
mysql_query($qryHistory);

if($rec2)
{
header("location:q2.php");
}
}		
?>